package sskj.regulatory.presentation.adapter

import android.content.Context
import android.view.ViewGroup
import com.jude.easyrecyclerview.adapter.BaseViewHolder
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter
import kotlinx.android.synthetic.main.item_signed.view.*
import sskj.regulatory.R
import sskj.regulatory.data.model.sign.CaSummary

class SignedRecyclerArrayAdapter(context: Context?) : RecyclerArrayAdapter<CaSummary>(context) {

    override fun OnCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder<*> {
        return ItemViewHolder(parent)
    }

    internal inner class ItemViewHolder(parent: ViewGroup) : BaseViewHolder<CaSummary>(parent, R.layout.item_signed) {


        override fun setData(data: CaSummary) {

            itemView.mCaSummaryTitleTv.text = data.title
            itemView.mCaSummaryPtimeTv.text = data.ptime
            itemView.mCaSummaryTypeTv.text = data.jllx

//            val resources = context.resources

            when (data.docqz) {
                true -> itemView.msCaSummaryZtTv.text = "已签"
                false -> itemView.msCaSummaryZtTv.text = "未签"
            }


//            if (data?.docqz != null && data?.docqz) {
//                itemView.msCaSummaryZtTv?.text = "已签"
//                //itemView.msCaSummaryZtTv?.background = resources.getDrawable(R.drawable.sign_yes_border)
//                //msCaSummaryZtTv.setTextColor(  R.color.material_green_500  );
//                // gradientDrawable.setStroke( 1, R.color.material_red_500);
//
//                //gradientDrawable.setColor( R.color.material_green_500 );
//            } else {
//                itemView.msCaSummaryZtTv?.text = "未签"
//                //itemView.msCaSummaryZtTv?.background = resources.getDrawable(R.drawable.sign_no_border)
//
//            }
        }
    }

}